4 // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
6 // The use and distribution terms for this software are contained in the file
7 // named license.txt, which can be found in the root of this distribution.
8 // By using this software in any fashion, you are agreeing to be bound by the
9 // terms of this license.
11 // You must not remove this notice, or any other, from this software.
16 namespace Microsoft
.JScript
{
18 using Microsoft
.JScript
.Vsa
;
20 using System
.Collections
;
22 public class VBArrayObject
: JSObject
{
25 public VBArrayObject(VBArrayPrototype parent
, Array array
)
28 this.noExpando
= false;
31 internal virtual int dimensions(){
32 return this.array
.Rank
;
35 internal virtual Object
getItem(Object
[] args
){
36 if (args
== null || args
.Length
== 0)
37 throw new JScriptException(JSError
.TooFewParameters
);
39 return this.array
.GetValue(Convert
.ToInt32(args
[0]));
41 return this.array
.GetValue(Convert
.ToInt32(args
[0]), Convert
.ToInt32(args
[1]));
43 return this.array
.GetValue(Convert
.ToInt32(args
[0]), Convert
.ToInt32(args
[1]), Convert
.ToInt32(args
[2]));
45 int[] intArgs
= new int[n
];
46 for (int i
= 0; i
< n
; i
++)
47 intArgs
[i
] = Convert
.ToInt32(args
[i
]);
48 return this.array
.GetValue(intArgs
);
51 internal virtual int lbound(Object dimension
){
52 int dim
= Convert
.ToInt32(dimension
);
53 return this.array
.GetLowerBound(dim
);
56 internal virtual ArrayObject
toArray(VsaEngine engine
){
57 IList aList
= this.array
;
58 ArrayObject result
= engine
.GetOriginalArrayConstructor().Construct();
61 IEnumerator e
= aList
.GetEnumerator();
64 result
.SetValueAtIndex(i
++, e
.Current
);
68 internal virtual int ubound(Object dimension
){
69 int dim
= Convert
.ToInt32(dimension
);
70 return this.array
.GetUpperBound(dim
);